package com.source.labelAndBarcode.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.source.labelAndBarcode.entity.BarcodeGrant;
import com.source.labelAndBarcode.mapper.BarcodeGrantMapper;
import com.source.labelAndBarcode.service.BarcodeGrantService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.source.labelAndBarcode.vo.BarcodeGrantVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Joey
 * @since 2021-02-23
 */
@Service
public class BarcodeGrantServiceImpl extends ServiceImpl<BarcodeGrantMapper, BarcodeGrant> implements BarcodeGrantService {

    @Autowired
    BarcodeGrantMapper grantMapper;

    @Override
    public List<BarcodeGrantVo> findBarcodeGrantAll() {
        return grantMapper.findBarcodeGrantAll();
    }

    @Override
    public IPage<BarcodeGrantVo> findBarcodeGrantAllOnPagination(Page<BarcodeGrantVo> page) {
        return grantMapper.findBarcodeGrantAllOnPagination(page);
    }

    @Override
    public BarcodeGrantVo findById(String id) {
        return grantMapper.findById(id);
    }

    @Override
    public int getGrantCountByTime(Date fromTime, Date toTime) {
        return grantMapper.getGrantCountByTime(fromTime, toTime);
    }

    @Override
    public IPage<BarcodeGrantVo> findByKeyWord(Page<BarcodeGrantVo> page, String keyWord) {
        return grantMapper.findByKeyWord(page,"%"+keyWord+"%");
    }
}
